package org.example.skytool.commom;

import org.example.exception.ParamLossErrorException;

/**
 * @author 22449
 */
public class ParamUtil {

    public static void StringParam(String... ids) {
        for (String id : ids) {
            if (StringUtil.isEmpty(id)) {
                throw new ParamLossErrorException("传入的某些参数为空或者为空字符串");
            }
        }
    }

    public static void BooleanParam(Boolean... ids){
        for (Boolean id : ids) {
            if (id==null) {
                throw new ParamLossErrorException("传入的某些参数为空或者为空字符串");
            }
        }
    }
    public static void IntegerParam(Integer... ids) {
        for (Integer id : ids) {
            if (id==null) {
                throw new ParamLossErrorException("传入的某些参数为空或者为空字符串");
            }
        }
    }
    public static void LongParam(Long... ids) {
        for (Long id : ids) {
            if (id==null) {
                throw new ParamLossErrorException("传入的某些参数为空或者为空字符串");
            }
        }
    }

    public static void LongParam(String... ids) {
        StringParam(ids);
        for (String id : ids) {
            try {
                Long value = Long.valueOf(id);
            } catch (Exception e) {
                throw new ParamLossErrorException("需要传入数字参数，但是参数不为数字:"+id);
            }
        }
    }


}
